#ifndef _IM_CALL_CENTER_CACHE_H_
#define _IM_CALL_CENTER_CACHE_H_

#include <stdint.h>
#include <string>
#include <set>
#include <boost/thread/shared_mutex.hpp>

namespace base {
class SimpleConnectionPool;
};

namespace imserver {

class CallCenterCache {
public:
  static CallCenterCache & Instance() {
    static CallCenterCache cache;
    return cache;
  }

  int Reload();
  bool IsWaiter(int64_t uid) const;
  bool IsCallCenter(int64_t uid) const;
private:
  CallCenterCache();

  CallCenterCache(const CallCenterCache &);
  CallCenterCache& operator=(const CallCenterCache&);

  base::SimpleConnectionPool * db_conn_pool_;

  std::set<int64_t> waiters_;
  mutable boost::shared_mutex waiters_mutex_;

  std::set<int64_t> call_centers_;
  mutable boost::shared_mutex call_centers_mutex_;
};

}

#endif // _IM_CALL_CENTER_CACHE_H_
